package com.itheima.config;

import com.itheima.intercetor.LoginCheckInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 网站配置
 *
 * @author liudo
 * @version 1.0
 * @project tlias-backend
 * @date 2023/9/12 16:06:28
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private LoginCheckInterceptor loginCheckInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginCheckInterceptor)
                // /** /*
                .addPathPatterns("/**")
                // 排除登录，不拦截登录的意思
                .excludePathPatterns("/login");
    }
}
